package com.ijunfu.utils;

import java.util.Objects;

/**
 *
 * @Title  : 
 * @Author : ijunfu <ijunfu@163.com>
 * @Date   : 2023/12/16 13:12
 * @Version: 1.0
 * @Motto  : 世界很大 世界很小
 *
 */
public class HeadThreadLocal {

    private static ThreadLocal<HeadThreadLocal> threadLocal = new ThreadLocal<>();

    private String token;

    private HeadThreadLocal() {
    }

    public static HeadThreadLocal getThreadLocalInstance() {
        HeadThreadLocal headThreadLocal = threadLocal.get();

        if(Objects.isNull(headThreadLocal)) {
            headThreadLocal = new HeadThreadLocal();
            threadLocal.set(headThreadLocal);
        }

        return headThreadLocal;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }
}
